package conf

import (
	"path"
	"generalhandler/utils"
	"fmt"
)

type CrawlerProxyConfig struct {
	Proxy string `json:"proxy"`
	Auth string `json:"auth"`
	Type string `json:"type"`
}

var cpc *CrawlerProxyConfig
func CrawlerProxyConfigInstance() *CrawlerProxyConfig {
	return cpc
}

func LoadCrawlerProxyConf() {
	path := path.Join(utils.GetSelfBinDirPath(), "crawlerproxy.config")
	if err := utils.LoadJsonFromFile(path, &cpc); nil != err {
		panic(fmt.Sprintf("failed to load crawler proxy config, cuz %s", err.Error()))
	}
}
